<include file="public@header" />
<style>.layui-table tr td{padding-left: 40px;}</style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <div class="layui-page-header">
            <div class="layui-card">
                <div class="layui-page-header-content">
                    <div class="layui-card-body">
                        <div class="layui-ui-page-header-title" >
                            后台菜单<span class="layui-badge-rim page-content">后台管理网站菜单管理及设置</span>
                        </div>
                    </div>
                    <div class="layui-tab layui-tab-brief">
                        <ul class="layui-tab-title">
                            <li class="layui-this"><a href="{:url('Menu/index')}">后台菜单</a></li>
                            <li><a href="javascript:admin.openIframeLayer('{:url('Menu/add')}','添加菜单',{btn: ['添加','关闭'],area:['720px', '600px'],end:function(){location.reload();}});">添加菜单</a></li>
                            <li><a href="{:url('Menu/lists')}">所有菜单</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-page-content">
            <div class="layui-card">
                <div class="layui-card-body js-check-wrap">
                    <form class="layui-form js-ajax-form" action="{:url('Menu/listOrder')}" method="post">
                        <div class="layui-btn-container">
                            <button type="submit" class="layui-btn layui-btn-sm js-ajax-submit">{:lang('SORT')}</button>
                        </div>
                        <table class="layui-table" lay-even lay-size="lg" id="menus-table">
                            <thead>
                            <tr>
                                <th width="50">{:lang('SORT')}</th>
                                <th width="50">ID</th>
                                <th>{:lang('NAME')}</th>
                                <th>操作</th>
                                <th width="80">{:lang('STATUS')}</th>
                                <th width="220">{:lang('ACTIONS')}</th>
                            </tr>
                            </thead>
                            <tbody>
                            {$category}
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<include file="public@script"/>
<script type="text/javascript">
    layui.use('layer', function(){
        var layer = layui.layer;
        $(document).ready(function(){
            $('.str').on('click',function(){
                //获取id
                var id = $(this).attr('data');
                var title = $(this).attr('data-title');
                //iframe层
                layer.open({
                    type: 2,
                    title: title,
                    area: ['720px', '600px'],
                    btn: ['添加','关闭'],
                    content: 'add/parent_id/'+id, //iframe的url
                    yes: function(index, layero) {
                        // do something
                        // 获取iframe层的body
                        var body = layer.getChildFrame('body', index);
                        // 找到隐藏的提交按钮模拟点击提交
                        body.find('#js-ajax-submit').click();
                    },
                    btn2: function(index, layero) {
                        layer.close(index)
                        return false;
                    }
                });
            })
            $('.bjr').on('click',function(){
                //获取id
                var id = $(this).attr('data');
                var title = $(this).attr('data-title');
                //iframe层
                layer.open({
                    type: 2,
                    title: title,
                    area: ['720px', '600px'],
                    btn: ['保存','关闭'],
                    content: 'edit/id/'+id, //iframe的url
                    yes: function(index, layero) {
                        // do something
                        // 获取iframe层的body
                        var body = layer.getChildFrame('body', index);
                        // 找到隐藏的提交按钮模拟点击提交
                        body.find('#js-ajax-submit').click();
                    },
                    btn2: function(index, layero) {
                        layer.close(index)
                        return false;
                    }
                });
            })
        })
    });
</script>
<script>
    $(document).ready(function() {
        Wind.css('treeTable');
        Wind.use('treeTable', function() {
            $("#menus-table").treeTable({
                indent : 20
            });
        });
    });
</script>
</body>
</html>